/**
 * Created by yanwenchuang on 2016/10/17.
 * 导航菜单指令
 */
var app = angular.module("app");
app.directive("crmNav", ["$http", "AuthService", function ($http, AuthService) {
    //获取用户登录名称，加载登录菜单功能
    //var user = AuthService.getCurrentUser();
        var rev = {
            restrict: 'A',
            replace:true,
            templateUrl:'/js/app/home/tpl/navigation.html',
            controller:function($scope, $element, $attrs, $transclude,NavigationService) {
                NavigationService.nav().then(function(data){
                    $scope.name=data.name;
                    $scope.code=data.code;
                    $scope.remark=data.remark;
                    $scope.navItems = data.subNavigation;
                    console.log(data);
                });
            },
            compile:function(tElement,tAttrs,transclude) {
                return {
                    pre: function(scope, iElement, iAttrs, controller) { },
                    post: function(scope, iElement, iAttrs, controller) { }
                }
            }
        };
        return rev;
    }
]);